package  
{
	import flash.display.Shape;
	import flash.geom.Matrix;
	import flash.display.GradientType;
	
	/**
	 * ...
	 * @author 
	 */
	public class Smoke extends Shape 
	{	
		public var startsim:uint;
		
		public function IsUsedUp():Boolean
		{
			return Main.Instance().simulationTimes - startsim >= 70;
		}
		
		public function Smoke() 
		{
			//startsim = Main.Instance().simulationTimes;
			var colors:Array = [0x000000, 0x000000,0x0000];
			var alphas:Array = [1, 1,0];
			var ratios:Array = [0,127, 255];
			var m:Matrix = new Matrix();
			m.createGradientBox(128, 128, 0, -64, -64);
			super();
			graphics.beginGradientFill(GradientType.RADIAL, colors, alphas, ratios, m);
			graphics.drawRect(-64, -64, 128, 128);
			graphics.endFill();
			//this.alpha = 2;
			//this.scaleX = 1;
			//this.scaleY = 1;
		}
		
		public function DrawAtT(ts:Number):void
		{
			var t:Number = Main.Instance().simulationTimes - startsim;
			if (t >= 70)
			{
				t = 1;
				//startsim = Main.Instance().simulationTimes; // Loop
			}
			else if (t <= 0) t = 0;
			else t = (t + ts) / 70;
			this.scaleX = 0.25 + 1*t;
			this.scaleY = 0.25 + 1*t;
			this.alpha = 1-t*t;
		}
		
	}

}